<?php

    // 4/22/2010: immanuel192 write this action

    if (!defined('EXPONENT')) exit('');

    $song_id = -1; 
    global $db;
    $i18n = exponent_lang_loadFile('modules/mailinglistmodule/actions/register.php');
    // get t2 value, just for fun
    $t2=$_GET['t2'];
    // test email value
    if (isset($_GET['value']))
    {

        $email = $_GET['value'];
        // for secirity, we will remove all ' and "
        $email = str_replace("'","",$email); $email = str_replace("\"","",$email);

        $object = $db->selectObject('maillinglist',"email='{$email}'");
        if (!$object) 
        {
            // here we add new email address
            $mail_obj=null;
            $mail_obj->email=$email;
            $db->insertObject($mail_obj,"maillinglist");
            echo $t2;
            echo $i18n["okies"];
        }
        else
        {
            echo $t2;
            echo $i18n["exist"];
        }
        // 
    }
    else
    {
        echo $t2;
        echo $i18n["error"];
    }
?>
